package com.atguigu.springcloud.alibaba.controller;

import com.atguigu.springcloud.alibaba.domain.CommonResult;
import com.atguigu.springcloud.alibaba.domain.Storage;
import com.atguigu.springcloud.alibaba.service.StorageSercive;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class StorageController {

    @Resource
    private StorageSercive storageSercive;


    @RequestMapping("/storage/decrease")
    public CommonResult create(@RequestParam("productId") Long productId,
                               @RequestParam("count") Integer count){
        storageSercive.decrease(productId,count);
        return new CommonResult(200,"扣减库存成功");

    }

}
